home *** CD-ROM | disk | FTP | other *** search
/ NOVA - For the NeXT Workstation / NOVA - For the NeXT Workstation.iso / Documents / NeXTAnswers / appkit.3 < prev    next >
Text File  |  1992-02-06  |  2KB  |  33 lines

  1. {\rtf0\ansi{\fonttbl\f2\fnil Times-Roman;\f0\fmodern Courier;}
  2. \paperw11840
  3. \paperh9000
  4. \margl120
  5. \margr120
  6. \pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600\f2\b0\i0\ul0\fs28 command line arguments argv argc parameters appkit\
  7. \
  8. Q:  How can I use argv and argc?\
  9. \
  10. A:  We do not recommend making your application rely on command line arguments because they will not be available when the program is launched by the Workspace Manager.  Use the Defaults mechanism instead, and provide an Options or Preferences panel by which your users change the default values.  See 
  11. \b NXRegisterDefaults
  12. \b0 () and 
  13. \b NXGetDefaultValue
  14. \b0 ().\
  15. \
  16. Currently  the Application object sets various parameters based on command line argument pairs of the form  "- 
  17. \i <flag>
  18. \i0  
  19. \i <value>
  20. \i0 "  (such as  -host MyHost  or  -NXShowPS YES ) and then removes those arguments from argv and argc.  Your program should not depend on argv and argc, instead use the variables NXArgv and NXArgc that can be used anywhere within your program after the first message is sent, that is, after the initialize methods have completed.  These variables will contain the arguments remaining after the Defaults-type arguments have been removed.  NXArgv[0] will be the full pathname of a Workspace Manager-launched application.  Note: if the program was launched from a shell then NXArgv[0] will contain the path specified in the command.  In order to write a very robust app, one should check whether the value begins at "/". \
  21.  \
  22. You will need to import <appkit/defaults.h> to get the declarations of the variables NXArgv and NXArgc.\
  23.  
  24. \f0\fs24 \
  25. \
  26.  
  27. \f2\fs28 QA3\
  28. \
  29. Valid for 1.0\
  30. Valid for 2.0\
  31. \
  32.  
  33.